package controller

import (
	"github.com/gin-gonic/gin"
	"io/ioutil"
	"log"
	"net/http"
)

func IpPage(c *gin.Context) {
	resp, err := http.Get("http://myexternalip.com/raw")
	if err != nil {
		log.Printf("Get Ip By myexternalip.com Error:%v", err)
	}
	defer resp.Body.Close()
	ip, err := ioutil.ReadAll(resp.Body)
	c.HTML(http.StatusOK, "ip.html", gin.H{
		"ip": string(ip),
	})
}
